package com.book.controller;


import com.book.model.Role;
import com.book.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wx
 * @since 2023-10-11 23:56:02
 */
@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    @GetMapping("/getAll")
    public List<Role> getAll(){
        return roleService.getAll();
    }
    @PostMapping("addRole")
    public void addRole(Role role, Long[] mids){
        roleService.addRole(role,mids);
    }
    @PutMapping("updateRole")
    public void updateRole(Role role,Long[] mids){
        roleService.updateRole(role,mids);
    }
    @DeleteMapping("deleteRole")
    public void deleteRole(Long rid){
        roleService.deleteRole(rid);
    }
}
